package as.dao;

import java.util.ArrayList;
import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import as.entity.Course;
import as.entity.Register;
import as.entity.Student;

import as.entity.Teacher;

public class TeacherDAO extends HibernateDaoSupport{

	public void saveTeacher(Teacher teacher) {
		this.getHibernateTemplate().save(teacher);
	}
	
	@SuppressWarnings("unchecked")
	public List<Teacher> findAllTeachersByCourseId(long id){
		

		final String hql = "from Teacher  where course_id=? ";
		List<Teacher> list = new ArrayList<Teacher>();
		list=this.getHibernateTemplate().find(hql,id);
		return list;
		
	}
	
	public void RemoveTeacheList(List<Teacher> list){
		this.getHibernateTemplate().delete(list);
	}
	public void removeTeacher(Teacher teacher){
		this.getHibernateTemplate().delete(teacher);
		
	}
	public Teacher findTeacherIs(long id){

		Teacher teacher = (Teacher) this.getHibernateTemplate().get(Teacher.class, id);
		return teacher;
	
	}
	
}
